home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Science / Asymptote Demo / Examples / Utility Scripts / powerlawfit < prev    next >
Text File  |  1994-05-07  |  403b  |  19 lines

  1. % powerlawfit  xmin xmax
  2.  
  3. % DESCRIPTION:
  4. % For log-log graphs. Fit y = a0 + a1*x for x in the given range.
  5.  
  6. % ARGUMENTS:
  7. %        xmin  = minimum x to include in fit
  8. %        xmax  = maximum x to include in fit
  9.  
  10. % •Note:This script modifies the e vector and replaces the y data
  11. %       with the calclated fit.
  12.  
  13. rpn <x &1 < <x &2 > + <x &1 >= <x &2 <= * 0.0001 * + >e
  14.  
  15. fitxy 1
  16.  
  17. rpn a0 <x a1 * + >y
  18.  
  19. close